package com.heima.media.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.media.entity.WmUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.heima.media.service.IWmUserService;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 自媒体用户信息表 前端控制器
 * </p>
 *
 * @author syl
 * @since 2022-06-26
 */
@RestController
@RequestMapping("/api/v1/user")
@Api(tags = "自媒体用户信息表接口")
@CrossOrigin
public class WmUserController{

    @Autowired
    private IWmUserService wmUserService;

    @PostMapping
    @ApiOperation(value = "saveWmUser", notes = "保存自媒体用户")
    @ApiImplicitParam(name = "wmUser", dataType = "WmUser", required = true)
    public ResponseResult<WmUser>saveWmUser(@RequestBody WmUser wmUser){

        return wmUserService.saveWmUser(wmUser);
    }

    @PutMapping
    @ApiOperation(value = "updateWmUser", notes = "保存更新自媒体用户")
    @ApiImplicitParam(name = "wmUser", dataType = "WmUser", required = true)
    public ResponseResult<WmUser>updateWmUser(@RequestBody WmUser wmUser){
        wmUserService.updateById(wmUser);

        return ResponseResult.okResult();
    }

}
